<script type="text/javascript">

 var action="test.do?method=showCalendar";

 var todaydate=new Date(2006,2-1,1);

 var curday=todaydate.getDate();
 var selectedDay = curday;

 var curmonth=todaydate.getMonth()+1 ; //get current month (1-12)
 var selectedMonth = curmonth;

 var curyear=todaydate.getFullYear() ; //get current year
 var selectedYear = curyear;

 function displayCalendar(){
    var calendarstr=buildCal(selectedDay,selectedMonth , selectedYear, "main", "month", "daysofweek", "days", 0,action)
    if (document.getElementById)
      document.getElementById("calendarspace").innerHTML=calendarstr;
 }

 function previousMonth(){
    selectedMonth = selectedMonth-1;
    if(selectedMonth==0) {
	selectedMonth=12;
	selectedYear=selectedYear-1;
    };
    var calendarstr=buildCal(selectedDay,selectedMonth, selectedYear, "main", "month", "daysofweek", "days", 0,action)
    if (document.getElementById)
      document.getElementById("calendarspace").innerHTML=calendarstr;
 }

 function nextMonth(){
    selectedMonth = selectedMonth+1;
    if(selectedMonth==13) {
	selectedMonth=1;
	selectedYear=selectedYear+1;
    };
    var calendarstr=buildCal(selectedDay,selectedMonth , selectedYear, "main", "month", "daysofweek", "days", 0,action)
    if (document.getElementById)
      document.getElementById("calendarspace").innerHTML=calendarstr;
 }

 function todayNow(){
     todaydate = new Date();
     
     curday=todaydate.getDate();
     selectedDay = curday;

     curmonth=todaydate.getMonth()+1 ; //get current month (1-12)
     selectedMonth = curmonth;
 
     curyear=todaydate.getFullYear() ; //get current year
     selectedYear = curyear;
     displayCalendar();
 }



</script>
